home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: Special XP & Vista
/
Chip Spesial XP & Vista.iso
/
3_Gadgets
/
GVideoPlayer
/
GVideoPlayer.gg
/
main.js
< prev
next >
Wrap
Text File
|
2007-10-22
|
7KB
|
276 lines
_wmp = Player.object;
var RSSURL = "rss";
options.defaultValue(RSSURL) = "http://lastream001.galaxytelevision.net/cartoonsChannel?.wma";
plugin.onShowOptionsDlg = ShowOptionsDlg;
function ShowOptionsDlg(wnd) {
wnd.AddControl(gddWndCtrlClassLabel, 0, "", "Stream URL" + ':', 10, 10, 380, 25);
var urlField = wnd.AddControl(gddWndCtrlClassEdit, 0, "urlField", "", 10, 35, 350, 25);
urlField.text = options(RSSURL);
// handlers
wnd.onClose = OptionsDlgClosed;
}
function OptionsDlgClosed(wnd, code) {
if (gddIdOK != code) {
return;
}
var urlField = wnd.GetControl("urlField");
var feedURL = urlField.text;
var i=options.getValue("media_count")-1;
if (i>=0) {
do {
if (options.getValue("media_"+i) == feedURL) {
alert("Already in the list!");
return;
}
} while (i--);
}
options.putValue("media_"+options.getValue("media_count"),feedURL);
options.putValue("media_count",options.getValue("media_count")+1);
options(RSSURL) = feedURL;
_wmp.URL = feedURL;
view.setInterval(displayStatus, 1000);
}
pluginHelper.onAddCustomMenuItems = function(menu) {
var templateSub=menu.AddPopup(TEMPLATE);
var i=options.getValue("media_count")-1;
var i2;
if (i>=0) {
do {
i2=options.getValue("media_"+i);
templateSub.AddItem(i2,0,uploadFile);
} while (i--);
}
if (options.getValue("media_count")) {
templateSub.AddItem("",0,function(){return false;});
}
templateSub.AddItem(TEMPLATE_ADD,0,addMedia);
if (options.getValue("media_count")) {
var templateRemoveSub=templateSub.AddPopup(TEMPLATE_REMOVE);
i=options.getValue("media_count")-1;
do {
var i2=options.getValue("media_"+i);
templateRemoveSub.AddItem(i2,0,removeMedia);
} while (i--);
}
}
options.putDefaultValue("media_count",0);
function addMedia() {
var fileName = framework.BrowseForFile("Media Files |*.wmv;*.avi;*.mp3;*.wma;*.dat;|All Files|*.*");
if (fileName.length) {
_wmp.URL = fileName;
view.setInterval(displayStatus, 1000);
var i=options.getValue("media_count")-1;
if (i>=0) {
do {
if (options.getValue("media_"+i) == fileName) {
alert("Already in the list!");
return;
}
} while (i--);
}
options.putValue("media_"+options.getValue("media_count"),fileName);
options.putValue("media_count",options.getValue("media_count")+1);
}
}
function uploadFile(path) {
_wmp.URL = path;
view.setInterval(displayStatus, 1000);
}
function getFileName(path) {
var tmp=path.split("\\");
return tmp.pop();
}
function removeMedia(fileName) {
var templates=new Array();
var i=options.getValue("media_count")-1;
do {
templates[i]=options.getValue("media_"+i);
if (templates[i] == fileName) {
var num=i;
}
options.remove("media_"+i);
} while (i--);
if (confirm("Really remove this link?\n"+fileName)) {
templates.splice(num,1);
}
options.putValue("media_count",templates.length);
var i=templates.length-1;
if (i>=0) {
do {
options.putValue("media_"+i,templates[i]);
} while (i--);
}
}
function extract(f) {
if (options.exists(f)) {
if (framework.system.filesystem.fileExists(options.getValue(f))) {
return options.getValue(f);
}
}
return options.getValue(f);
}
/*
options.putDefaultValue("view","3");
options.putDefaultValue("showOptions","true");
options.putDefaultValue("update_interval",300000); // 5 minutes
options.putDefaultValue("templates_count",0);
var loadingImg = new Array();
var transfers=new Array();
var updateQueued=false;
var itemsCache;
var updateCount=0;
var queueUpdate;
function uploadFile(path) {
on_drag_drop(path);
}
function queueUpdate() {
if (updateQueued==false) {
updateQueued=true;
setTimeout(update,100);
}
}
function changeView() {
addItems(true,itemsCache);
}
function on_drag_drop(fileName) {
_wmp.controls.play(fileName);
}
pluginHelper.onAddCustomMenuItems = function(menu) {
var viewSub=menu.AddPopup("View");
viewSub.AddItem("1",(options.getValue("view")==1)?gddMenuItemFlagChecked:0,function(){options.putValue("view","1");});
viewSub.AddItem("2",(options.getValue("view")==2)?gddMenuItemFlagChecked:0,function(){options.putValue("view","2");});
viewSub.AddItem("3",(options.getValue("view")==3)?gddMenuItemFlagChecked:0,function(){options.putValue("view","3");});
menu.AddItem(REFRESH,0,queueUpdate);
menu.AddItem("",0,function(){return false;});
var templateSub=menu.AddPopup(TEMPLATE);
templateNameHack=new Array();
var i=options.getValue("templates_count")-1;
var i2;
if (i>=0) {
do {
i2=options.getValue("templates_"+i);
templateSub.AddItem(i2,0,uploadFile);
} while (i--);
}
if (options.getValue("templates_count")) {
templateSub.AddItem("",0,function(){return false;});
}
templateSub.AddItem(TEMPLATE_ADD,0,addTemplate);
if (options.getValue("templates_count")) {
var templateRemoveSub=templateSub.AddPopup(TEMPLATE_REMOVE);
i=options.getValue("templates_count")-1;
do {
var i2=options.getValue("templates_"+i);
templateRemoveSub.AddItem(i2,0,removeTemplate);
} while (i--);
}
};
*/
function view_onOpen() {
//view.setInterval(displayStatus, 1000);
}
var volume_value = 50;
function displayStatus() {
if(_wmp.playState == 0)
status.innerText = "Undefined";
else if(_wmp.playState == 1)
status.innerText = "Stopped";
else if(_wmp.playState == 2)
status.innerText = "Paused";
else if(_wmp.playState == 3)
status.innerText = "Playing";
else if(_wmp.playState == 4)
status.innerText = "ScanForward";
else if(_wmp.playState == 5)
status.innerText = "ScanReverse";
else if(_wmp.playState == 6)
status.innerText = "Buffering";
else if(_wmp.playState == 7)
status.innerText = "Waiting";
else if(_wmp.playState == 8)
status.innerText = "MediaEnded";
else if(_wmp.playState == 9)
status.innerText = "Transitioning";
else if(_wmp.playState == 10)
status.innerText = "Ready";
else if(_wmp.playState == 11)
status.innerText = "Reconnecting";
}
function play_onclick() {
_wmp.controls.play();
}
function stop_onclick() {
_wmp.controls.stop();
}
function hide_mute() {
_wmp.settings.volume = 50;
img2.visible = true
img3.visible = false
}
function show_mute() {
_wmp.settings.volume = 0
img2.visible = false
img3.visible = true
}
function button1_onclick() {
if(volume_value != null) {
if(volume_value < 100) {
volume_value = volume_value + 10;
_wmp.settings.volume = volume_value;
}
}
}
function button2_onclick() {
if(volume_value != null) {
if(volume_value > 0) {
volume_value = volume_value - 10;
_wmp.settings.volume = volume_value;
}
}
}
function img1_onclick() {
}
function button3_onclick() {
addMedia();
}